import React from 'react';
import PropTypes from 'prop-types';
import {injectIntl} from './intl';
import {Card, Row, Col} from 'antd';
import {conventEnumValueToString} from '../utils';
import {baseDataStatus, currency, recommendLevel} from '../Enum';
import DescriptionList from 'ant-design-pro/lib/DescriptionList';
const {Description} = DescriptionList;
import styles from './style.css';
/* eslint-disable react/prefer-stateless-function */
class Detail extends React.PureComponent {
    render() {
        return (
            <div>
                <Card>
                    <DescriptionList size="large" title={<Row><Col span={6}>{this.props.intl.formatMessage({
                        id: 'commonDetail.order.title',
                        defaultMessage: '银行信息'
                    })}</Col>
                    <Col className={styles.optionBtn} span={18}>{this.props.operations}</Col></Row>}>
                        <Description
                            term={this.props.intl.formatMessage({
                                id: 'commonDetail.info.code',
                                defaultMessage: '编号'
                            })}>
                            {this.props.detail.code}
                        </Description>
                        <Description
                            term={this.props.intl.formatMessage({
                                id: 'commonDetail.info.brandCode',
                                defaultMessage: '品牌编号'
                            })}>
                            {this.props.detail.brandCode}
                        </Description>
                        <Description
                            term={this.props.intl.formatMessage({
                                id: 'commonDetail.info.brandName',
                                defaultMessage: '品牌名称'
                            })}>
                            {this.props.detail.brandName}
                        </Description>
                        <Description
                            term={this.props.intl.formatMessage({
                                id: 'commonDetail.info.name',
                                defaultMessage: '银行名称'
                            })}>
                            {this.props.detail.name}
                        </Description>
                        <Description
                            term={this.props.intl.formatMessage({
                                id: 'commonDetail.info.engName',
                                defaultMessage: '英文名称'
                            })}>
                            {this.props.detail.engName}
                        </Description>
                        <Description
                            term={this.props.intl.formatMessage({
                                id: 'commonDetail.info.account',
                                defaultMessage: '银行账号'
                            })}>
                            {this.props.detail.account}
                        </Description>
                        <Description
                            term={this.props.intl.formatMessage({
                                id: 'commonDetail.info.accountCode',
                                defaultMessage: '银行识别码'
                            })}>
                            {this.props.detail.accountCode}
                        </Description>
                        <Description
                            term={this.props.intl.formatMessage({
                                id: 'commonDetail.info.companyName',
                                defaultMessage: '公司名称'
                            })}>
                            {this.props.detail.companyName}
                        </Description>
                        <Description
                            term={this.props.intl.formatMessage({
                                id: 'commonDetail.info.currency',
                                defaultMessage: '币种'
                            })}>
                            {conventEnumValueToString(currency, this.props.detail.currency)}
                        </Description>
                        <Description
                            term={this.props.intl.formatMessage({
                                id: 'commonDetail.info.recommendLevel',
                                defaultMessage: '推荐程度'
                            })}>
                            {conventEnumValueToString(recommendLevel, this.props.detail.recommendLevel)}
                        </Description>
                        <Description
                            term={this.props.intl.formatMessage({
                                id: 'commonDetail.info.status',
                                defaultMessage: '状态'
                            })}>
                            {conventEnumValueToString(baseDataStatus, this.props.detail.status)}
                        </Description>
                    </DescriptionList>
                    <DescriptionList col={1} className={styles.mgtp} size="large">
                        <Description
                            term={this.props.intl.formatMessage({
                                id: 'commonDetail.info.address',
                                defaultMessage: '地址'
                            })}>
                            {this.props.detail.address}
                        </Description>
                    </DescriptionList>
                </Card>
            </div>
        );
    }
}

Detail.defaultProps = {
    detail: {},
};

Detail.propTypes = {
    detail: PropTypes.object,
    intl: PropTypes.object,
    isDetail: PropTypes.bool,
    operations: PropTypes.any,
};
export default injectIntl(Detail);
